package com.tony.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.stereotype.Component;

@Component
public class LogHandler {
    public void LogBefore() {
        System.out.println("Log before method...");
    }

    public void LogAfter() {
        System.out.println("Log after method...");
    }

    public void LogParamter(ProceedingJoinPoint joinPoint) throws Throwable {
        Object[] objs = joinPoint.getArgs();
        for (int i=0;i<objs.length;i++) {
            Object obj = objs[i];
            System.out.println("------------"+obj);
            if (obj.equals("tony")){
                objs[i] = "tom";
                System.out.println("修改后的值："+objs[i].toString());
            }
        }
        joinPoint.proceed(objs);
    }

}
